package com.klm.easymq.demo.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 演示配置类
 * 用于初始化演示数据和配置
 */
@Slf4j
@Configuration
public class DemoConfig {
    
    /**
     * 应用启动后执行初始化
     */
    @Bean
    public CommandLineRunner demoInitializer() {
        return args -> {
            log.info("🎉 Easy-MQ Demo 应用初始化完成！");
            log.info("📋 可用的API接口：");
            log.info("   POST   /api/demo/orders          - 创建订单");
            log.info("   PUT    /api/demo/orders/{id}/status - 更新订单状态");
            log.info("   DELETE /api/demo/orders/{id}     - 取消订单");
            log.info("   GET    /api/demo/inventory       - 获取库存信息");
            log.info("   GET    /api/demo/inventory/{id}  - 获取特定商品库存");
            log.info("   GET    /api/demo/stats           - 获取统计信息");
            log.info("   POST   /api/demo/orders/batch    - 批量创建订单");
            log.info("");
            log.info("🔧 监控和管理：");
            log.info("   📊 健康检查: http://localhost:9001/actuator/health");
            log.info("   🎛️  Web控制台: http://localhost:9001/easymq");
            log.info("   📈  Prometheus指标: http://localhost:9001/actuator/prometheus");
            log.info("");
            log.info("💡 使用示例：");
            log.info("   1. 创建订单: curl -X POST http://localhost:9001/api/demo/orders \\");
            log.info("      -H 'Content-Type: application/json' \\");
            log.info("      -d '{\"userId\":\"user001\",\"productId\":\"prod001\",\"productName\":\"iPhone 15\",\"amount\":9999.99}'");
            log.info("");
            log.info("   2. 查看库存: curl http://localhost:9001/api/demo/inventory");
            log.info("");
            log.info("   3. 查看统计: curl http://localhost:9001/api/demo/stats");
        };
    }
} 